local function getPickupType(i)
	if i == 2 then
		return 30
	elseif i == 1 then
		return 31
	end

	local w = GenerateRandomIntInRange(5, 17, _i)

	if w == 8 or w == 6 then
		w = 4
	end

	return w
end

local function createPickup(ptype, etype, unk, x, y, z)
	if ptype == 30 then
		CreatePickupWithAmmo(0x972daa10, etype, 0, x, y, z, _i)
	elseif ptype == 31 then
		CreatePickupWithAmmo(0x3fc62578, etype, 0, x, y, z, _i)
	else
		CreatePickupWithAmmo(GetWeapontypeModel(ptype, _i), etype, 60, x, y, z, _i)
	end
end

local pickupSeed

local function createPickups()
	echo("creating algo pickups\n")

	SetRandomSeed(pickupSeed)

	createPickup( getPickupType( 2 ), 23, 200, -563.10640000, 293.52680000, 5.65930000 )
	createPickup( getPickupType( 2 ), 23, 200, 79.41570000, -839.53680000, 3.99560000 )
	createPickup( getPickupType( 2 ), 23, 200, -277.35550000, -533.76340000, 3.92420000 )
	createPickup( getPickupType( 2 ), 23, 200, -491.51540000, -173.97790000, 6.90340000 )
	createPickup( getPickupType( 2 ), 23, 200, -235.68930000, 739.30850000, 6.12510000 )
	createPickup( getPickupType( 2 ), 23, 200, -539.49120000, 1362.38800000, 16.47050000 )
	createPickup( getPickupType( 2 ), 23, 200, -180.02360000, -823.41240000, 4.11750000 )
	createPickup( getPickupType( 2 ), 23, 200, 173.60920000, 236.49170000, 13.76010000 )
	createPickup( getPickupType( 2 ), 23, 200, 89.24590000, 1152.34900000, 13.57080000 )
	createPickup( getPickupType( 2 ), 23, 200, 63.60470000, -439.60590000, 13.75830000 )
	createPickup( getPickupType( 2 ), 23, 200, -226.95040000, 1714.70300000, 14.75500000 )
	createPickup( getPickupType( 2 ), 23, 200, 130.44570000, 467.39240000, 13.91780000 )
	createPickup( getPickupType( 2 ), 23, 200, -529.52310000, -339.29980000, 5.04460000 )
	createPickup( getPickupType( 2 ), 23, 200, -477.98870000, 1707.35300000, 7.46380000 )
	createPickup( getPickupType( 2 ), 23, 200, -636.54130000, -45.71210000, 3.81230000 )
	createPickup( getPickupType( 2 ), 23, 200, 140.68720000, -857.79680000, 3.77320000 )
	--createPickup( getPickupType( 2 ), 23, 200, -108.89000000, 64499, 4.11910000 )
	createPickup( getPickupType( 2 ), 23, 200, 348.54010000, -431.52940000, 3.54320000 )
	createPickup( getPickupType( 2 ), 23, 200, 166.63900000, 1080.60900000, 13.62470000 )
	createPickup( getPickupType( 2 ), 23, 200, -145.57280000, 1694.71300000, 15.72350000 )
	createPickup( getPickupType( 2 ), 23, 200, 64.54370000, 261.20720000, 14.53200000 )
	createPickup( getPickupType( 2 ), 23, 200, -507.19360000, 533.97330000, 5.67160000 )
	createPickup( getPickupType( 2 ), 23, 200, -410.23560000, -141.84080000, 11.61790000 )
	createPickup( getPickupType( 2 ), 23, 200, -248.26890000, -589.95000000, 3.78540000 )
	createPickup( getPickupType( 2 ), 23, 200, 115.38710000, 741.87240000, 13.56160000 )
	createPickup( getPickupType( 2 ), 23, 200, 49.21290000, 1350.85200000, 15.25260000 )
	createPickup( getPickupType( 2 ), 23, 200, 332.02520000, -158.35070000, 8.06910000 )
	createPickup( getPickupType( 1 ), 23, 200, -462.60650000, 775.56370000, 8.98430000 )
	createPickup( getPickupType( 1 ), 23, 200, -66.39730000, 1550.17700000, 17.64730000 )
	createPickup( getPickupType( 1 ), 23, 200, -47.94850000, 35.91300000, 13.84780000 )
	createPickup( getPickupType( 1 ), 23, 200, -210.80500000, 1410.40400000, 19.35510000 )
	createPickup( getPickupType( 1 ), 23, 200, 136.81580000, 387.45690000, 14.02680000 )
	createPickup( getPickupType( 1 ), 23, 200, -604.36200000, 339.06450000, 3.67190000 )
	createPickup( getPickupType( 1 ), 23, 200, -135.90700000, 819.94900000, 17.62560000 )
	createPickup( getPickupType( 1 ), 23, 200, -437.64390000, 430.90700000, 8.93740000 )
	createPickup( getPickupType( 1 ), 23, 200, -522.79810000, 1018.30500000, 8.79210000 )
	createPickup( getPickupType( 1 ), 23, 200, -593.54960000, 1165.60900000, 8.94090000 )
	createPickup( getPickupType( 1 ), 23, 200, 89.78390000, 1251.53900000, 14.86610000 )
	createPickup( getPickupType( 1 ), 23, 200, -108.15450000, 1271.20900000, 19.43000000 )
	createPickup( getPickupType( 1 ), 23, 200, -5.26000000, -447.87000000, 13.75820000 )
	createPickup( getPickupType( 1 ), 23, 200, 171.83730000, -807.45750000, 3.97040000 )
	createPickup( getPickupType( 1 ), 23, 200, 0.32430000, -761.24270000, 4.08570000 )
	createPickup( getPickupType( 1 ), 23, 200, -526.37620000, 593.51290000, 12.12300000 )
	createPickup( getPickupType( 1 ), 23, 200, -554.97370000, 806.93090000, 8.05520000 )
	createPickup( getPickupType( 1 ), 23, 200, 13.89740000, 1147.71300000, 13.24760000 )
	createPickup( getPickupType( 1 ), 23, 200, 179.53490000, 691.26530000, 7.18630000 )
	createPickup( getPickupType( 1 ), 23, 200, -463.63800000, 899.77910000, 8.96270000 )
	createPickup( getPickupType( 1 ), 23, 200, -467.32180000, 1556.19000000, 17.47570000 )
	createPickup( getPickupType( 1 ), 23, 200, -284.66330000, 1600.64600000, 19.41570000 )
	createPickup( getPickupType( 1 ), 23, 200, -311.56230000, 1733.49700000, 12.12580000 )
	createPickup( getPickupType( 1 ), 23, 200, -99.43640000, 1350.29900000, 19.41500000 )
	createPickup( getPickupType( 1 ), 23, 200, -534.05160000, 1610.99600000, 8.39809000 )
	createPickup( getPickupType( 1 ), 23, 200, 91.99830000, -318.91000000, 13.61250000 )
	createPickup( getPickupType( 1 ), 23, 200, -619.61000000, -115.38000000, 5.59590000 )
	createPickup( getPickupType( 1 ), 23, 200, 361.06920000, -477.77790000, 4.81800000 )
	createPickup( getPickupType( 1 ), 23, 200, -404.86420000, 1487.26800000, 17.86060000 )
	createPickup( getPickupType( 1 ), 23, 200, -572.86970000, 227.56950000, 3.66220000 )
	createPickup( getPickupType( 0 ), 23, 200, 150.65500000, 913.75690000, 7.35240000 )
	createPickup( getPickupType( 0 ), 23, 200, -151.58120000, 1004.30900000, 5.22660000 )
	createPickup( getPickupType( 0 ), 23, 200, -126.16370000, 554.53360000, 13.76430000 )
	createPickup( getPickupType( 0 ), 23, 200, -389.27630000, 1763.59200000, 8.23320000 )
	createPickup( getPickupType( 0 ), 23, 200, -414.94510000, 376.06220000, 11.07520000 )
	createPickup( getPickupType( 0 ), 23, 200, -348.11940000, 631.42010000, 13.58580000 )
	createPickup( getPickupType( 0 ), 23, 200, -561.26700000, 1457.39500000, 16.53680000 )
	createPickup( getPickupType( 0 ), 23, 200, -656.75510000, 1140.68700000, 8.81430000 )
	createPickup( getPickupType( 0 ), 23, 200, 286.89990000, -392.37890000, 3.97690000 )
	createPickup( getPickupType( 0 ), 23, 200, 267.28000000, -686.88580000, 3.87500000 )
	createPickup( getPickupType( 0 ), 23, 200, 185.85650000, 801.42330000, 7.45320000 )
	createPickup( getPickupType( 0 ), 23, 200, -33.85220000, 772.73390000, 13.64890000 )
	createPickup( getPickupType( 0 ), 23, 200, -658.17000000, 809.31000000, 3.10420000 )
	--createPickup( getPickupType( 0 ), 23, 200, 65123, 1658.10000000, 20.08190000 )
	--createPickup( getPickupType( 0 ), 23, 200, 65307, 1445.20000000, 19.45000000 )
	createPickup( getPickupType( 0 ), 23, 200, -579.01340000, 1414.69400000, 14.47110000 )
	createPickup( getPickupType( 0 ), 23, 200, -570.93210000, 158.32300000, 3.66220000 )
	createPickup( getPickupType( 0 ), 23, 200, -641.65510000, -195.11170000, 3.94450000 )
	createPickup( getPickupType( 0 ), 23, 200, -373.43770000, 1563.55700000, 19.15690000 )
	createPickup( getPickupType( 0 ), 23, 200, -242.26720000, -515.22510000, 3.93780000 )
	createPickup( getPickupType( 0 ), 23, 200, 83.27290000, 128.63830000, 13.74580000 )
	createPickup( getPickupType( 0 ), 23, 200, 100.85700000, -751.07600000, 3.95820000 )
	createPickup( getPickupType( 0 ), 23, 200, 148.27850000, -520.31800000, 13.76100000 )
	createPickup( getPickupType( 0 ), 23, 200, -145.85800000, -436.54300000, 13.71600000 )
	createPickup( getPickupType( 0 ), 23, 200, 30.52840000, -319.98200000, 13.72060000 )
	createPickup( getPickupType( 0 ), 23, 200, -121.35400000, -765.42500000, 4.20210000 )
	createPickup( getPickupType( 0 ), 23, 200, -301.78400000, -408.61900000, 3.82400000 )
	createPickup( getPickupType( 0 ), 23, 200, -221.12500000, -244.63100000, 13.55080000 )
	createPickup( getPickupType( 0 ), 23, 200, 345.52040000, -409.60800000, 3.69260000 )
	createPickup( getPickupType( 0 ), 23, 200, -187.78400000, -104.23300000, 13.59230000 )
	createPickup( getPickupType( 0 ), 23, 200, 23.03970000, -41.08220000, 13.81190000 )
	createPickup( getPickupType( 0 ), 23, 200, -105.90000000, 129.42250000, 13.72260000 )
	createPickup( getPickupType( 0 ), 23, 200, -470.49600000, 190.20460000, 8.85820000 )
	createPickup( getPickupType( 0 ), 23, 200, -108.92700000, 371.07960000, 13.80730000 )
	createPickup( getPickupType( 0 ), 23, 200, -308.23960000, 455.43910000, 13.69960000 )
	createPickup( getPickupType( 0 ), 23, 200, 113.34910000, 650.53870000, 13.71280000 )
	createPickup( getPickupType( 0 ), 23, 200, -69.89160000, 1147.73100000, 13.76710000 )
	createPickup( getPickupType( 0 ), 23, 200, 29.31370000, 761.22520000, 13.50620000 )
	createPickup( getPickupType( 0 ), 23, 200, 52.12710000, 889.81030000, 13.65160000 )
	createPickup( getPickupType( 0 ), 23, 200, -616.57000000, 1001.96400000, 8.91920000 )
	createPickup( getPickupType( 0 ), 23, 200, -491.81600000, 949.22980000, 8.96670000 )
	createPickup( getPickupType( 0 ), 23, 200, 5.79550000, 1028.96500000, 13.72000000 )
	createPickup( getPickupType( 0 ), 23, 200, -542.94400000, 1303.59300000, 16.25890000 )
	createPickup( getPickupType( 0 ), 23, 200, -273.10860000, 1211.38200000, 17.78520000 )
	createPickup( getPickupType( 0 ), 23, 200, -292.14300000, 1331.30300000, 23.60140000 )
	createPickup( getPickupType( 0 ), 23, 200, -364.25800000, 1371.32500000, 14.19140000 )
	createPickup( getPickupType( 0 ), 23, 200, -34.57900000, 1410.33300000, 19.42230000 )
	createPickup( getPickupType( 0 ), 23, 200, -161.42200000, 1555.53300000, 17.37360000 )
	createPickup( getPickupType( 0 ), 23, 200, 210.82320000, -105.36900000, 13.76120000 )
	createPickup( getPickupType( 0 ), 23, 200, -124.28630000, -530.18220000, 13.76020000 )
	createPickup( getPickupType( 0 ), 23, 200, -220.20000000, -883.72000000, 3.67810000 )
	createPickup( getPickupType( 0 ), 23, 200, -107.78000000, -821.86000000, 4.12670000 )
	createPickup( getPickupType( 0 ), 23, 200, 78.03000000, -670.74000000, 13.76770000 )
	createPickup( getPickupType( 0 ), 23, 200, 151.18900000, -613.04700000, 9.63030000 )
	createPickup( getPickupType( 0 ), 23, 200, -27.54000000, -823.69000000, 4.45430000 )
	createPickup( getPickupType( 0 ), 23, 200, 200.28920000, -698.77010000, 3.95350000 )
	createPickup( getPickupType( 0 ), 23, 200, -195.15000000, -711.21000000, 3.96790000 )
	createPickup( getPickupType( 0 ), 23, 200, 100.96000000, -512.62000000, 15.08830000 )
	createPickup( getPickupType( 0 ), 23, 200, 306.47000000, -623.30000000, 4.19430000 )
	createPickup( getPickupType( 0 ), 23, 200, -79.41310000, 614.20590000, 13.76610000 )
	createPickup( getPickupType( 0 ), 23, 200, -385.48000000, 738.49000000, 13.76610000 )
	createPickup( getPickupType( 0 ), 23, 200, -434.99950000, 1101.79400000, 9.24650000 )
	createPickup( getPickupType( 0 ), 23, 200, -31.37680000, 959.19130000, 13.92130000 )
	createPickup( getPickupType( 0 ), 23, 200, -268.25000000, 751.37000000, 10.86610000 )
	createPickup( getPickupType( 0 ), 23, 200, -199.04800000, 880.55260000, 5.15900000 )
	createPickup( getPickupType( 0 ), 23, 200, -330.31000000, 1134.31000000, 12.49350000 )
	createPickup( getPickupType( 0 ), 23, 200, -174.81230000, 938.15850000, 10.64700000 )
	createPickup( getPickupType( 0 ), 23, 200, -115.90590000, 1043.57100000, 5.15920000 )
	createPickup( getPickupType( 0 ), 23, 200, -315.16000000, 867.71000000, 8.89900000 )
	createPickup( getPickupType( 0 ), 23, 200, -564.60000000, 1183.60000000, 9.01900000 )
	createPickup( getPickupType( 0 ), 23, 200, -498.02150000, 1183.31100000, 13.21080000 )
	createPickup( getPickupType( 0 ), 23, 200, -414.29530000, 1365.34600000, 15.55880000 )
	createPickup( getPickupType( 0 ), 23, 200, -468.98060000, 1468.96400000, 17.86100000 )
	createPickup( getPickupType( 0 ), 23, 200, -112.28410000, 1672.74500000, 17.61140000 )
	createPickup( getPickupType( 0 ), 23, 200, -219.91810000, 1277.23200000, 22.09290000 )
	createPickup( getPickupType( 0 ), 23, 200, 2.40000000, 1197.70000000, 16.47760000 )
	createPickup( getPickupType( 0 ), 23, 200, -25.70000000, 1250.90000000, 19.43250000 )
	createPickup( getPickupType( 0 ), 23, 200, -65.74770000, 1498.05800000, 17.44880000 )
	createPickup( getPickupType( 0 ), 23, 200, -383.30600000, 319.06300000, 13.75090000 )
	--createPickup( getPickupType( 0 ), 23, 200, 65250, 344.20000000, 13.66590000 )
	createPickup( getPickupType( 0 ), 23, 200, -212.60000000, 346.70000000, 14.03540000 )
	createPickup( getPickupType( 0 ), 23, 200, -66.26470000, 278.22370000, 13.76360000 )
	createPickup( getPickupType( 0 ), 23, 200, -181.14000000, 491.28420000, 13.71490000 )
	createPickup( getPickupType( 0 ), 23, 200, -24.70000000, 405.20000000, 14.76350000 )
	createPickup( getPickupType( 0 ), 23, 200, 51.61110000, 464.46720000, 13.69600000 )
	createPickup( getPickupType( 0 ), 23, 200, 27.60000000, 374.20000000, 13.70190000 )
	createPickup( getPickupType( 0 ), 23, 200, -603.98900000, 612.11540000, 3.85550000 )
	createPickup( getPickupType( 0 ), 23, 200, -337.70000000, 215.40000000, 13.74920000 )
	createPickup( getPickupType( 0 ), 23, 200, -383.50000000, 556.30000000, 13.77870000 )
	createPickup( getPickupType( 0 ), 23, 200, -442.96920000, 590.37180000, 10.25190000 )
	createPickup( getPickupType( 0 ), 23, 200, 141.80000000, 211.20000000, 13.76310000 )
	createPickup( getPickupType( 0 ), 23, 200, -192.30000000, 162.40000000, 13.98940000 )
	createPickup( getPickupType( 0 ), 23, 200, -348.60300000, -188.71300000, 13.64900000 )
	createPickup( getPickupType( 0 ), 23, 200, -273.48200000, -157.81400000, 13.88300000 )
	createPickup( getPickupType( 0 ), 23, 200, -117.97000000, -335.54000000, 13.73490000 )
	createPickup( getPickupType( 0 ), 23, 200, -12.45000000, -218.40000000, 13.63990000 )
	createPickup( getPickupType( 0 ), 23, 200, 179.94720000, -254.52090000, 11.85560000 )
	createPickup( getPickupType( 0 ), 23, 200, 264.98180000, -302.83180000, 5.59270000 )
	createPickup( getPickupType( 0 ), 23, 200, 162.58500000, -158.31150000, 13.92630000 )
	createPickup( getPickupType( 0 ), 23, 200, 113.02140000, -39.66420000, 13.76250000 )
	createPickup( getPickupType( 0 ), 23, 200, -126.60700000, -117.37200000, 13.81500000 )
	createPickup( getPickupType( 0 ), 23, 200, 207.01740000, 20.70740000, 13.71320000 )
	createPickup( getPickupType( 0 ), 23, 200, -254.45000000, -43.88000000, 13.76330000 )
	createPickup( getPickupType( 0 ), 23, 200, -347.84500000, 105.27390000, 13.81310000 )
	createPickup( getPickupType( 0 ), 23, 200, -345.03400000, -100.46700000, 13.70210000 )
	createPickup( getPickupType( 0 ), 23, 200, -445.05100000, 131.98950000, 8.83120000 )
	createPickup( getPickupType( 0 ), 23, 200, -490.37520000, 25.33320000, 6.86600000 )
	createPickup( getPickupType( 0 ), 23, 200, -572.51200000, 86.31020000, 3.81230000 )
	createPickup( getPickupType( 0 ), 23, 200, 29.85000000, -601.28000000, 13.69580000 )
	createPickup( getPickupType( 0 ), 23, 200, -184.29000000, 102.09000000, 13.76770000 )
end

AddEventHandler('createGunPickups', function(seed)
    pickupSeed = seed

    RemoveAllPickupsOfType(23)
	createPickups()
end)
